package sanrenxing.dayEnd.backRepertoryTotal.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import sanrenxing.dayEnd.backRepertoryTotal.domain.AssetValuation;

import java.util.List;

/**
 * 功能：资产估值的数据层接口类
 * 作者：赵思睿
 * 日期：2021/3/30 0030-14:03
 * 版本：1.0
 */

public interface AssetValuationDao {
    /**
     * 查询显示资产估值
     * @return
     */
    @Select("select jj.*,rownum assetId from (select mm.inputDate dates,ff.seId,ff.seName,(mm.closePrice*ss.secNum-ss.costs*ss.secNum) valuation,ss.fundId,ss.caId,ss.secNum from financialsecurities ff " +
            "join marketData mm on ff.seId=mm.seId join securitiesStock ss on ff.seId=ss.seId where to_char(mm.inputDate,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')) jj")
    public List<AssetValuation> findAll();

    /**
     * 删除证券应收应付库存表中之前的估值增值数据
     * @return
     */
    @Delete("delete from secRecAndPayStock where businType='估值增值' and to_char(dates,'yyyy-MM-dd')<to_char(sysdate,'yyyy-MM-dd')")
    public int delete();
}
